< previous page page_110 next page >

Page 110
9f31265bb40b592b1929e18a47ab28e5.gif
dtBegin = #9/1/98#
dtTime = #10:10:00 AM#
intLoop = 10
lngID = 100000
sngQty = 2.5
dblAmount = 3.2233
curPrice = 500.65
strName = "Paul"
Examples Filename: Vars.bas
All the numeric values are pretty straightforward when youre doing the assignment statements. The Boolean value will accept the keyword True or False as an assignment. The Date and Time values are denoted with a pound sign (#), and a string value is enclosed by double quotes. You can find this code in the Vars.bas file. Look for the procedure called VariableAssignment in the Procedures combo box.
Scope and Lifetime of a Variable
When you declare a variable, you automatically determine a couple of characteristics of that variable. The first is its scopethat is, which procedures can view and change the contents of that variable. The second characteristic is the lifetime of the variablethat is, how long the value stays in memory. Table 6.2 shows the three types of scope a variable can have within a Visual Basic application.
Table 6.2 Scope Definitions.
ScopeDescription
GlobalA variable that can be viewed and changed by any routine within an application.
Module levelA variable thats declared at the top of a form or standard module and can be viewed or changed by any routine within that module.
LocalA variable thats declared within a routine and can only be viewed and changed within that routine.

 
< previous page page_110 next page >

If you like this book, buy it!